calculation of fourier coefficient